home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Development
/
General
/
ViewIt™ 2.24 Shareware
/
Pascal Demo Projects
/
Metrowerks Pascal 1.0d7 Demos
/
vDemoMP.p
< prev
next >
Wrap
Text File
|
1994-03-02
|
4KB
|
133 lines
{ViewIt 2.2 Demonstration Program}
{©FaceWare 1991-94. All Rights Reserved.}
program vDemoMP;
uses
FaceStorMP, FaceProcMP;
var
helpShown: boolean;
myRec: record
myInteger: integer;
myReal: real;
myString: string[99];
myFlags: longint;
end;
myList: integer;
oldTicks, newTicks: longint;
theReal, delta: real;
procedure JumpIt (thePtr: Ptr);
inline
$2257, $2051, $4E90;
procedure OverProc (thePtr: Ptr);
begin
with fRec do
if (uCommand = 264) then {a key down message?}
if (uParam[1] = 32) then {SPACE key pressed?}
uParam[1] := 95; {convert to UNDERLINE}
JumpIt(thePtr); {pass message to driver}
end;
begin
myRec.myInteger := 0;
myRec.myReal := 6.2;
myRec.myString := 'Hello';
myRec.myFlags := 10;
myList := 2;
oldTicks := 0;
theReal := 6.0;
{Initialize FaceIt}
fRec.uName := 'vDemo.Rsrc';
FaceIt(nil, DoInit, 0, 0, 0, 0);
{Open Modeless Window using FWND 1000}
FaceIt(nil, NewWnd, 1000, 1, 0, 0);
with fRec do
repeat
FaceIt(nil, DoLoop, 0, 0, 0, 0);
{Standard "About" Menu Item Selection}
if (uMenuID = 101) and (uMenuItem = 1) then
begin
uString := concat('Demonstration of the use of ViewIt', chr(13), 'windows in a FaceIt-based program.');
FaceIt(nil, ShoStr, 3, 12, 1 + (409 * 65536), 0);
end
{Hit in Modeless Window's "Open Modal" Button}
else if (uMenuID = 1000) and (wcHit = 2) then
begin
FaceIt(nil, NewWnd, 1001, 0, 0, 0); {Open Modal Window}
repeat
FaceIt(nil, MdlWnd, 1001, 0, 0, 0); {Process Modal Events}
if (wcHit = -1) then {Hit in Close Box}
leave
else if (wcHit = 1) then {Hit in "Open Nested" Button}
begin {Open Nested Modal}
FaceIt(nil, NewWnd, 1002, 0, 110, ord(@myRec));
FaceIt(nil, GetCtl, 1002, 0, 3, 3); {Link Scrollable List}
FaceIt(nil, LnkCtl, ord(cControl), ord(@myList), 2, 0);
FaceIt(nil, GetCtl, 1002, 0, 2, 3); {Set Override Proc}
FaceIt(nil, OvrCtl, ord(cControl), ord(@OverProc), 0, 0);
FaceIt(nil, SetVal, 1002, 0, 0, 0); {Set Linked Values}
helpShown := false;
repeat
FaceIt(nil, MdlWnd, 1002, -2, 0, 0); {Process Modal Events}
if (uMenuID = 0) then {No Message}
begin
newTicks := TickCount;
if (newTicks > oldTicks + 60) then
begin
oldTicks := newTicks;
FaceIt(nil, GetCtl, 1002, 0, 2, 8);
SetCtlValue(cControl, (cValue mod 4) + 1);
end;
end
else if (wvHit = 1) then {Hit in View #1}
begin
if (wcHit = 1) then {Hit in "OK" Button}
leave
else if (wcHit = 2) then {Hit in "Show/Hide" Button}
if helpShown then
begin
FaceIt(nil, ShoCtl, 0, 0, -3, 2); {Hide v3, Show v2}
helpShown := false;
end
else
begin
FaceIt(nil, ShoCtl, 0, 0, -2, 3); {Hide v2, Show v3}
helpShown := true;
end;
end
else if (wvHit = 2) then {Hit in View #2}
if (wcHit = 6) or (wcHit = 7) then {Hit in Up/Down Arrow}
begin
FaceIt(nil, GetCtl, 1002, 0, 2, wcHit);
delta := 0.001 * (cMin - 2);
myRec.myReal := myRec.myReal + delta;
FaceIt(nil, SetVal, 1002, 0, 2, 2);
Delay(5, uI4);
end;
until false;
FaceIt(nil, GetVal, 1002, 0, 0, 0); {Get Linked Values}
FaceIt(nil, EndWnd, 1002, 0, 0, 0); {Close Nested Modal}
end;
until false;
FaceIt(nil, EndWnd, 1001, 0, 0, 0); {Close Modal Window}
end
{Hit in Modeless Window's "Why ViewIt?" Button}
else if (uMenuID = 1000) and (wcHit = 3) then
begin
FaceIt(nil, NewWnd, 1003, 0, 0, ord(@theReal));
FaceIt(nil, SetVal, 1003, 0, 0, 0);
repeat
FaceIt(nil, MdlWnd, 1003, 0, 0, 0);
until (wcHit = 1);
FaceIt(nil, GetVal, 1003, 0, 0, 0);
FaceIt(nil, EndWnd, 1003, 0, 0, 0);
end;
until false;
end.